<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTransversesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('transverses', function (Blueprint $table) {
            $table->id();
            $table->string('code')->unique()->comment('项目流水号');
            $table->string('name')->comment('项目名称');
            $table->integer('user_id')->comment('申请人ID');
            $table->string('user_name', 30)->nullable()->comment('负责人');
            $table->string('contract_type')->nullable()->comment('合同类型');
            $table->string('entrust_company')->nullable()->comment('委托单位');
            $table->string('buyer')->nullable()->comment('合作单位');
            $table->string('buyer_unified_code')->nullable()->comment('甲方统一社会信用代码');
            $table->string('buyer_person')->nullable()->comment('甲方联系人');
            $table->string('buyer_phone')->nullable()->comment('甲方联系电话');
            $table->string('buyer_address')->nullable()->comment('合作单位地址');
            $table->float('amount', 11, 4)->default(0)->comment('合同金额');
            $table->float('in_amount', 11, 4)->default(0)->comment('到账金额');
            $table->string('domain')->nullable()->comment('所属领域');
            $table->date('sign_date')->nullable()->comment('签订时间');
            $table->string('sign_address')->nullable()->comment('签订地点');
            $table->string('assist_company')->nullable()->comment('外协单位');

            $table->integer('department_id')->default(0)->comment('所属部门');

            $table->tinyInteger('state')->default(0)->comment('项目状态');
            $table->tinyInteger('review_status')->default(0)->comment('审核状态');
            $table->tinyInteger('dept_review_status')->default(0)->comment('院系审核');
            $table->string('review_remark')->nullable()->comment('审核备注');
            $table->text('file')->nullable()->comment('附件');
            $table->string('file2')->nullable()->comment('承诺书');
            $table->string('file3')->nullable();
            $table->string('file4')->nullable();

            $table->integer('creator_id')->default(0)->comment('创建人ID');

            $table->tinyInteger('tag')->default(0)->comment('标签1技术合同登记');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('transverses');
    }
}
